<?php
namespace App\Http\Controllers;

use App\Models\Selectedline;
use App\Models\Selectedmenu;
use Illuminate\Support\Facades\Schema;

class SelectedlineController extends WxBaseController{
    protected $except=['index','show','menu','menuend'];
    public function index($type=1,$num=10){
        $lines = Selectedline::where('type',$type)->simplePaginate($num);
        editImageUrl($lines);
        return $this->apiReturn(true,'success',$lines);
    }
    public function show($id){
        $line = Selectedline::where('id',$id);
        //更新浏览量
        if(Schema::hasColumn('selectedlines', 'watch')){
            $line->increment('watch');
        };
        $arr = $line->get();
        editImageUrl($arr);
        return $this->apiReturn(true,'success',$arr);
    }
    public function menu(){
        $menus = Selectedmenu::get();
        editImageUrl($menus);
        return $this->apiReturn(true,'success',$menus);
    }
}